package com.rljk.service.impl;

import java.util.List;
import javax.annotation.Resource;

import com.rljk.service.AgentManager;
import org.springframework.stereotype.Service;
import com.rljk.common.dao.DaoSupport;
import com.github.pagehelper.PageHelper;
import com.rljk.domain.common.PageData;

/** 
 * 说明： 申请成为代理商
 * 创建人：zhanglingbing
 * 创建时间：2018-07-19
 * @version
 */
@Service("agentService")
public class AgentService implements AgentManager {

	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		dao.save("AgentMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		dao.delete("AgentMapper.delete", pd);
	}
	
	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		dao.update("AgentMapper.edit", pd);
	}
	
	/**分页列表
	 * @param currentPage
	 * @param pageSize
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<PageData> listPage(int currentPage,int pageSize,PageData pd)throws Exception{
	    PageHelper.startPage(currentPage,pageSize);
		return (List<PageData>)dao.findForList("AgentMapper.listAll", pd);
	}
	
	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<PageData> listAll(PageData pd)throws Exception{
		return (List<PageData>)dao.findForList("AgentMapper.listAll", pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return (PageData)dao.findForObject("AgentMapper.findById", pd);
	}
	
	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		dao.delete("AgentMapper.deleteAll", ArrayDATA_IDS);
	}
	
}

